index.html.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb breadcrumb_phone_none">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <div class="breadcrumb_box breadcrumb_pc_none">
  23. <span class=" ">当前位置:</span>
  24. <NuxtLink to="/">首页</NuxtLink>
  25. <span class=" ">&gt;</span>
  26. <span class=" ">
  27. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  28. </span>
  29. </div>
  30. <!-- 资讯列表 -->
  31. <div class="newsDetail">
  32. <div class="inner">
  33. <div class="innerDetail">
  34. <div class="headImg"></div>
  35. <div class="innerDetail1">
  36. <div class="leftBottom" v-html="newsDetail.content"></div>
  37. </div>
  38. <div class="footImg"></div>
  39. </div>
  40. <div class="innerLeft phone_none">
  41. <ul>
  42. <li>
  43. 导航列表
  44. </li>
  45. <li v-for="(item, index) in bottomMenu" :key="index">
  46. <NuxtLink v-if="item.type == 0" :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  47. :class="item.id == pageId ? 'active' : ''">
  48. {{ item.name }}
  49. </NuxtLink>
  50. <NuxtLink v-else-if="item.type == 1" :to="`/about/${item.name_pinyin}/list-1.html`"
  51. :title="item.name" :class="item.id == pageId ? 'active' : ''">
  52. {{ item.name }}
  53. </NuxtLink>
  54. </li>
  55. </ul>
  56. </div>
  57. <div style="clear: both;"></div>
  58. </div>
  59. </div>
  60. <!-- 广告二 -->
  61. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  62. <!-- 页面底部 -->
  63. <HomeFoot1></HomeFoot1>
  64. </template>
  65. <script setup>
  66. //1.页面依赖 start ---------------------------------------->
  67. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  68. import { ArrowRight } from '@element-plus/icons-vue'
  69. import { ref, onMounted } from 'vue';
  70. //获得跳转过来的id
  71. const route = useRoute();
  72. //获得当前的完整路径
  73. const fullPath = route.path;
  74. //拆分,取出来中间这一段,然后提取数字部分
  75. const segments = fullPath.split('/');
  76. const targetSegment = segments[2];
  77. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  78. let num = ref(0);
  79. let articleId;
  80. let pageId;
  81. //通过导航路径反向查询导航id
  82. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  83. method: 'GET',
  84. query: {
  85. 'foot_pinyin': targetSegment,
  86. },
  87. });
  88. if (getRouteId.code == 200) {
  89. articleId = getRouteId.data.id;
  90. pageId = getRouteId.data.id;
  91. } else {
  92. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  93. console.log("错误位置:通过url路径查询导航池id")
  94. console.log("后端错误反馈:", getRouteId.message)
  95. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  96. }
  97. //1.页面依赖 end ---------------------------------------->
  98. //2.页面数据 start ---------------------------------------->
  99. //广告列表
  100. const adList = ref([]);
  101. let adImg1 = ref([]);
  102. let adImg2 = ref([]);
  103. async function getAdData() {
  104. const adData = await requestDataPromise('/web/getWebsiteAdvertisement', { method: 'GET', query: { 'ad_tag': 'PAGE' } });
  105. adList.value = adData.data;
  106. if (adData.code == 200) {
  107. for (let item of adData.data) {
  108. if (item.ad_tag == 'PAGE_0001') {
  109. adImg1.value = item;
  110. }
  111. if (item.ad_tag == 'PAGE_0002') {
  112. adImg2.value = item;
  113. }
  114. }
  115. } else {
  116. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  117. console.log("错误位置:获取详情页广告列表")
  118. console.log("后端错误反馈:", adData.message)
  119. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  120. }
  121. }
  122. getAdData();
  123. const newsDetail = ref({})
  124. const bottomMenu = ref([]);
  125. async function getPageData() {
  126. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  127. method: 'GET',
  128. query: {
  129. 'fcat_id': articleId,
  130. 'type': 0
  131. },
  132. });
  133. newsDetail.value = mkdata.data;
  134. }
  135. getPageData();
  136. async function getPageMenu() {
  137. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  138. method: 'GET',
  139. query: {},
  140. });
  141. if (mkdata.code == 200) {
  142. bottomMenu.value = mkdata.data;
  143. mkdata.data.forEach((item, index) => {
  144. if (item.id == articleId) {
  145. num.value = index;
  146. }
  147. });
  148. }
  149. }
  150. getPageMenu();
  151. //2.页面数据 end ---------------------------------------->
  152. //4.设置seo信息 start---------------------------------------->
  153. //4.1 设置seo信息
  154. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  155. method: 'GET',
  156. query: {},
  157. });
  158. let seoTitle = setData.data.website_head.title;
  159. let seoDescription = setData.data.website_head.description;
  160. let seoKeywords = setData.data.website_head.keywords;
  161. let seoSuffix = setData.data.website_head.suffix;
  162. let seoName = setData.data.website_head.website_name;
  163. useSeoMeta({
  164. title: seoTitle + "_" + seoSuffix,
  165. meta: [
  166. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  167. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  168. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  169. ]
  170. });
  171. //4.设置seo信息 end---------------------------------------->
  172. onMounted(async () => {
  173. //从客户端获取行政职能部门 加快打开速度
  174. const { $webUrl, $CwebUrl } = useNuxtApp();
  175. //广告1
  176. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nfcpgxw_page_0001`
  177. const responseAd1 = await fetch(url, {
  178. headers: {
  179. 'Content-Type': 'application/json',
  180. 'Userurl': $CwebUrl,
  181. 'Origin': $CwebUrl
  182. }
  183. });
  184. const resultAd1 = await responseAd1.json();
  185. adImg1.value = resultAd1.data[0];
  186. //广告2
  187. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nfcpgxw_page_0002`
  188. const responseAd2 = await fetch(url2, {
  189. headers: {
  190. 'Content-Type': 'application/json',
  191. 'Userurl': $CwebUrl,
  192. 'Origin': $CwebUrl
  193. }
  194. });
  195. const resultAd2 = await responseAd2.json();
  196. adImg2.value = resultAd2.data[0];
  197. })
  198. </script>
  199. <style lang="less" scoped>
  200. @import '@/assets/css/about.less';
  201. </style>
  202. <style lang="less" scoped>
  203. @media screen and (min-width:801px){/*pc*/
  204. .breadcrumb_pc_none{display:none!important;}
  205. .pc_none{display:none;}
  206. }
  207. @media screen and (max-width:800px){/*ipad_phone*/
  208. .breadcrumb_box{
  209. height:22px;width:100%;margin:16px auto 9px;
  210. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  211. width:92%;
  212. font-size:14px;
  213. color:#666;
  214. *{
  215. font-size:14px;
  216. display:inline ;
  217. color:#666;
  218. line-height:22px;height:22px;
  219. margin-right:5px;
  220. }
  221. }
  222. .newsDetail{min-height:auto;}
  223. .newsDetail .inner{width:92%!important;}
  224. .newsDetail .inner .innerDetail{width:100%;margin-bottom:8px;}
  225. .newsDetail .inner .innerDetail .innerDetail1{width:100%;padding:10px;}
  226. .newsDetail .inner .innerDetail .headImg{display:none;}
  227. .newsDetail .inner .innerDetail .footImg{display:none;}
  228. .newsDetail .inner .innerDetail .innerDetail1{background:rgba(0,0,0,0);border:1px solid #c6d9f0;}
  229. .newsDetail .inner .innerDetail .leftBottom *{
  230. font-size: 16px!important;;
  231. line-height: 22px;
  232. }
  233. .breadcrumb_phone_none{display:none!important;}
  234. // .innerLeft{display:none;}
  235. .phone_none{display:none;}
  236. }
  237. </style>